package com.bookcloud.java21.chapter4.继承super关键字48;

public class Animal {
  protected String name;
  protected int age;

  public Animal() {
    System.out.println("动物无参构造");
  }

  public Animal(String name, int age) {
    System.out.println("动物有参构造");
    this.name = name;
    this.age = age;
  }

  public void eat() {
    System.out.println(this.getName() + "=>动物正在吃");
  }

  public void sleep() {
    System.out.println(this.name + "=>动物正在睡");
  }

  public void run() {
    System.out.println(this.name + "=>动物正在跑");
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }
}
